﻿using System;
using System.Windows;
using System.Windows.Navigation;

namespace DataImporterExporter
{
    /// <summary>
    /// Interaction logic for WizardPage11.xaml
    /// </summary>
    public partial class WizardPage1 : PageFunction<WizardResult>
    {
        public WizardPage1(WizardData wizardData)
        {
            InitializeComponent();

            DataContext = wizardData;
        }
        
        public void nextButton_Click(object sender, RoutedEventArgs e)
        {
            // Go to next wizard page
            PageFunction<WizardResult> wizardPage2;
            if(radImport.IsChecked == true)
            {
                wizardPage2 = new ImportPage1(DataContext as WizardData);
            }
            else
            {
                wizardPage2 = new ExportPage1(DataContext as WizardData);
            }
            wizardPage2.Return += new ReturnEventHandler<WizardResult>(wizardPage_Return);
            this.NavigationService.Navigate(wizardPage2);
        }

        public void wizardPage_Return(object sender, ReturnEventArgs<WizardResult> e)
        {
            // If returning, wizard was completed (finished or canceled),
            // so continue returning to calling page
            OnReturn(e);
        }
    }
}
